import "@site/src/languages/highlight";

# Rect Class

**Description:**

&emsp;&emsp;A class for creating rectangle objects.

## zero

**Type:** Readonly Field.

**Description:**

&emsp;&emsp;A rectangle object with all properties set to 0.

**Signature:**
```tl
const zero: Rect
```

## __call

**Type:** Metamethod.

**Description:**

&emsp;&emsp;Create a new rectangle object using another rectangle object.

**Signature:**
```tl
metamethod __call: function(self: RectClass, other: Rect): Rect
```

**Parameters:**

| Parameter | Type | Description |
| --- | --- | --- |
| other | Rect | The other rectangle object to create a new rectangle object from. |

**Returns:**

| Return Type | Description |
| --- | --- |
| Rect | A new rectangle object. |

## __call

**Type:** Metamethod.

**Description:**

&emsp;&emsp;Create a new rectangle object using individual properties.

**Signature:**
```tl
metamethod __call: function(self: RectClass,
		x: number,
		y: number,
		width: number,
		height: number): Rect
```

**Parameters:**

| Parameter | Type | Description |
| --- | --- | --- |
| x | number | The x-coordinate of the origin of the rectangle. |
| y | number | The y-coordinate of the origin of the rectangle. |
| width | number | The width of the rectangle. |
| height | number | The height of the rectangle. |

**Returns:**

| Return Type | Description |
| --- | --- |
| Rect | A new rectangle object. |

## __call

**Type:** Metamethod.

**Description:**

&emsp;&emsp;Create a new rectangle object using a Vec2 object for the origin and a Size object for the size.

**Signature:**
```tl
metamethod __call: function(self: RectClass, origin: Vec2, size: Size): Rect
```

**Parameters:**

| Parameter | Type | Description |
| --- | --- | --- |
| origin | Vec2 | The origin of the rectangle, represented by a Vec2 object. |
| size | Size | The size of the rectangle, represented by a Size object. |

**Returns:**

| Return Type | Description |
| --- | --- |
| Rect | A new rectangle object. |

## __call

**Type:** Metamethod.

**Description:**

&emsp;&emsp;Create a new rectangle object with all properties set to 0.

**Signature:**
```tl
metamethod __call: function(self: RectClass): Rect
```

**Returns:**

| Return Type | Description |
| --- | --- |
| Rect | A new rectangle object. |